Skip to content

fs,path: fix glob globstar section bounds - #66738

Open
gurgunday wants to merge 1 commit into
nodejs:mainfrom
gurgunday:fix-glob-globstar-bound
Open

gurgunday wants to merge 1 commit into
nodejs:mainfrom
gurgunday:fix-glob-globstar-bound

Conversation

@gurgunday

Copy link
Copy Markdown
Member

The last start index of each globstar-delimited body section was computed from the non-globstar prefix counts in reverse order. When sections have different lengths, the bound is too tight, so paths such as a/b/c/d/e failed to match **/a/b/c/**/d/**. This affected path.matchesGlob() and exclude patterns in fs.glob()

Compute the bound from the number of non-globstar parts in the section and every section after it

FYI minimatch has the bug too

The last start index of each globstar-delimited body section was
computed from the non-globstar prefix counts in reverse order. When
sections have different lengths, the bound is too tight, so paths
such as `a/b/c/d/e` failed to match `**/a/b/c/**/d/**`. This affected
`path.matchesGlob()` and `exclude` patterns in `fs.glob()`.

Compute the bound from the number of non-globstar parts in the
section and every section after it.

Signed-off-by: Gürgün Dayıoğlu <hey@gurgun.day>
@gurgunday
gurgunday requested a review from avivkeller October 14, 2026 18:54
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/path

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Oct 14, 2026
@avivkeller

Copy link
Copy Markdown
Member

FYI minimatch has the bug too

Is this a breaking change, since the previous implementation suffered the same issue? Or just a bug fix

@gurgunday

gurgunday commented Oct 14, 2026 •

Copy link
Copy Markdown
Member Author

I don't have a strong opinion, but this can't be backported anyway right? I think no active release has the C++ port? And previous releases (24, 26) have the bug from minimatch directly

@avivkeller avivkeller left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.49%. Comparing base (dd7235c) to head (0a97eb6).
⚠️ Report is 77 commits behind head on main.

Files with missing lines Patch % Lines
src/glob/glob_matcher.cc 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #66738   +/-   ##
=======================================
  Coverage   90.48%   90.49%           
=======================================
  Files         791      791           
  Lines      277204   277225   +21     
  Branches    53311    53315    +4     
=======================================
+ Hits       250841   250861   +20     
+ Misses      16760    16753    -7     
- Partials     9603     9611    +8     
Files with missing lines Coverage Δ
src/glob/glob_matcher.cc 66.80% <66.66%> (ø)

... and 28 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gurgunday gurgunday added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 14, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Oct 14, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@gurgunday gurgunday added author ready PRs with CI started, the required approvals, and no outstanding review comments. resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. labels Oct 15, 2026
@github-actions github-actions Bot removed the resume-ci Add this label to resume the latest eligible Jenkins CI run on a PR with an approving review. label Oct 15, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@vedchaudhari

Copy link
Copy Markdown
Contributor

Thanks for spotting this! Reported upstream in isaacs/minimatch#329, it's a regression since 10.2.3.

@gurgunday gurgunday added the commit-queue PRs queued for automated landing through the Commit Queue. label Oct 16, 2026
@nodejs-github-bot nodejs-github-bot added the lacks-second-approval Commit Queue PRs awaiting a second collaborator approval or completion of the required wait. label Oct 16, 2026
@gurgunday

Copy link
Copy Markdown
Member Author

Should I add do not land labels for these? Since the C++ wasn't back-ported either?

@aduh95

aduh95 commented Oct 19, 2026

Copy link
Copy Markdown
Contributor

Should I add do not land labels for these? Since the C++ wasn't back-ported either?

If it can't or shouldn't land, yes you should add the dont-land labels

@nodejs-github-bot nodejs-github-bot added commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. and removed commit-queue PRs queued for automated landing through the Commit Queue. lacks-second-approval Commit Queue PRs awaiting a second collaborator approval or completion of the required wait. labels Oct 19, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Commit Queue failed

   ✖  This PR needs to wait 52 more hours to land (or 0 minutes if there is one more approval)
   ⚠  This PR has conflicts that must be resolved

The pull request was removed from the Commit Queue and labeled commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. . After resolving the failure, remove that label and add commit-queue PRs queued for automated landing through the Commit Queue. to retry.

Full Commit Queue output
�[36m⠋�[39m Loading data for nodejs/node/pull/66738
�[36m⠋�[39m Loading data for nodejs/node/pull/66738
�[36m⠋�[39m Getting collaborator contacts from README of nodejs/node
�[36m⠋�[39m Getting PR from nodejs/node/pull/66738
�[36m⠋�[39m Getting reviews from nodejs/node/pull/66738
�[36m⠋�[39m Getting comments from nodejs/node/pull/66738
�[36m⠋�[39m Getting commits from nodejs/node/pull/66738
✔  Done loading data for nodejs/node/pull/66738
----------------------------------- PR info ------------------------------------
Title      fs,path: fix glob globstar section bounds (#66738)
Author     Gürgün Dayıoğlu <hey@gurgun.day> (@gurgunday)
Branch     gurgunday:fix-glob-globstar-bound -> nodejs:main
Labels     c++, author ready, needs-ci, commit-queue, lacks-second-approval
Commits    1
 - fs,path: fix glob globstar section bounds
Committers 1
 - Gürgün Dayıoğlu <hey@gurgun.day>
PR-URL: https://github.com/nodejs/node/pull/66738
Reviewed-By: Aviv Keller <me@aviv.sh>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/66738
Reviewed-By: Aviv Keller <me@aviv.sh>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 14 Oct 2026 18:54:41 GMT
   ✔  Approvals: 1
   ✔  - Aviv Keller (@avivkeller): https://github.com/nodejs/node/pull/66738#pullrequestreview-5523202911
   ✖  This PR needs to wait 52 more hours to land (or 0 minutes if there is one more approval)
   ⚠  This PR has conflicts that must be resolved
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2026-10-15T10:22:30Z: https://ci.nodejs.org/job/node-test-pull-request/78402/
�[36m⠙�[39m Querying data for job/node-test-pull-request/78402/
�[36m⠙�[39m Querying data for job/node-test-pull-request/78402/
�[36m⠙�[39m Querying API for job/node-test-pull-request/78402/
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
�[36m⠹�[39m Querying API for job/node-test-pull-request/78402/
   ✔  Aborted `git node land` session in /home/runner/work/node/node/.ncu

View workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-failed PRs whose Commit Queue landing failed and need manual intervention before retrying. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants